/**
 * 赞助添加
 * @param exports
 * @returns
 */
layui.define(['common','api','form','layer'],function(exports){
	var laytpl = layui.laytpl;
	var $ = layui.jquery;
	var form = layui.form();
	var layer = layui.layer;

	var api = layui.api;
	var common = layui.common;
	
	//监听提交
  	form.on('submit(formDemo)', function(data){
    		api.addDonate(data.field,function(res){
    			if(res.status == 200){
    				layer.alert(res.msg, {
			          icon: 1,
			          end:function(){
			          	location.href = '/blog/back/donate';
			          }
			    });
    			} else {
    				layer.msg(res.msg || res.code, {
					shift: 6
				});
    			}
    		});
    		return false;
  	});

	exports('donate-add',{});
});